import java.util.ArrayList;


/**
 * This class has one method
 * one is print the out put as edges
 * @author ldong
 *
 */
public class GraphTraverse {

	private ArrayList<Record> recList;
	private EdgeList edgeList;
	
	/**
	 * Constructor
	 * @param recList
	 */
	public GraphTraverse(ArrayList<Record> recList)
    {
		this.recList = recList;
		edgeList = new EdgeList();
	}
 
	/**
	 * print the out put as edges
	 */
	public void printEdge()
    {
		int sum = 0;
		for(int i= 1; i<recList.size() ;i++)
		{
			Edge e = new Edge(recList.get(i).getVertex(recList.get(i).size()-1),
					recList.get(i).getVertex(recList.get(i).size()-2),
					recList.get(i).getLastEdgeWeight() );
			
			sum += recList.get(i).getLastEdgeWeight();
			
			edgeList.addEdge2List(e);
		}
		
		System.out.println(edgeList);
		System.out.println(sum);
		
    }
}
